home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10447 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.iadfw.net!usenet
  2. From: Mark Nelson <markn@airmail.net>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: assembly code in c ?
  5. Date: Sun, 17 Mar 1996 17:25:24 -0600
  6. Organization: customer of Internet America
  7. Message-ID: <314C9F64.1ECE@airmail.net>
  8. References: <314C6E40.5111@cs.concordia.ca>
  9. NNTP-Posting-Host: dal01-02.ppp.iadfw.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  14.  
  15. Aaron H. Chu wrote:
  16. > Dear netters,
  17. > I would like to know whether it is possble to embed assembly
  18. > codes in a c program.
  19. > What about the problems when writing codes on different
  20. > platforms ?  Do I need to know the register sets well
  21. > before I attempt to write the program ?
  22.  
  23. There is no truly portable way to do this.  Most compilers allow
  24. inline assembly, generally using something like the _asm keyword.
  25. Unfortunately, there is no standard way to perform this.  The C++
  26. spec acknowledges the keyword, but doesn't enforce any sort of
  27. asm grammar or semantics.  So even two compilers that target the
  28. same platform will do things differently.
  29.  
  30. Likewise, two compilers from the same vendor that are targeting
  31. two different platforms will also do things differently.
  32.  
  33. If you have some inner-inner loop code that is extremely time
  34. critical, and you feel like it absolutely must be done using
  35. assembly language, you have no choice but to become well 
  36. acquainted with our good friend Mr. #ifdef.
  37.  
  38. Mark Nelson
  39. http://web2.airmail.net/markn
  40.